<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      th:replace="fragments/layout(title='设施设备-编辑',jsPaths='/static/js/devices/device/add.js')">
<div class="right" th:fragment="right">
    <!--面包屑-->
    <div class="breadcrumb layui-bg-gray">
                <span class="layui-breadcrumb" lay-separator=">">
                    <a th:href="@{/}">首页</a>
                    <a href="/devices">设备管理</a>
                    <a href="/devices">设施设备</a>
                    <a><cite>编辑</cite></a>
                </span>
    </div>

    <!--主体内容区-->
    <div class="form-content layui-container">
        <form class="layui-form" th:action="@{/devices/update}" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label must">设备名称</label>
                <div class="layui-input-block">
                    <input type="hidden" name="id" th:value="${devices.id}">
                    <input type="text" name="name" th:value="${devices.name}" maxlength="255" lay-verify="required"
                           placeholder="请输入设备名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label must">设备编号</label>
                <div class="layui-input-block">
                    <input type="text" name="code" maxlength="255" lay-verify="required" th:value="${devices.code}"
                           placeholder="请输入设备编号" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label must">设备价格</label>
                <div class="layui-input-block">
                    <input type="number" name="price" min="0" value="0"
                           oninput="if(value.length>10){value=value.slice(0,10)}else if (value.length==0){value=0}"
                           lay-verify="required" th:value="${devices.price}" placeholder="请输入设备价格" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label must">设备类型</label>
                <div class="layui-input-block">
                    <select name="type" lay-verify="required">
                        <option></option>
                        <option th:selected="${devices.type eq 1}" value="1">房间设备</option>
                        <option th:selected="${devices.type eq 2}" value="2">公共服务设备</option>
                        <option th:selected="${devices.type eq 3}" value="3">医疗康复设备</option>
                        <option th:selected="${devices.type eq 4}" value="4">安全保障设备</option>
                        <option th:selected="${devices.type eq 5}" value="5">行政办公设备</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item ">
                <label class="layui-form-label must">设备位置</label>
                <div class="layui-input-block">
                    <input type="text" name="position" th:value="${devices.position}" placeholder="请输入设备位置"
                           autocomplete="off" class="layui-input" lay-verify="required" maxlength="255">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn  layui-btn-normal" lay-submit lay-filter="submitBtn">保存</button>
                    <a href="/devices" class="layui-btn layui-btn-primary">返回</a>
                </div>
            </div>
        </form>

    </div>
</div>
</html>